package lv.solcraft.replication.server.rest.restlets;

import lv.solcraft.replication.server.boot.Main;

import org.restlet.Context;
import org.restlet.Restlet;
import org.restlet.data.Request;
import org.restlet.data.Response;

public class RestartServerRestlet extends Restlet {

    public RestartServerRestlet(Context context) {
        super(context);
    }

    @Override
    public void handle(Request request, Response response) {
        try {
            Main.getInstance().restart();
        } catch (Exception e) {
            throw new IllegalStateException("Restart failed", e);
        }
    }
}
